package cz.muni.fi.pa165.soap.client.manager;

import cz.muni.fi.pa165.soap.EmployeeDTO;
import cz.muni.fi.pa165.soap.EmployeeService;
import cz.muni.fi.pa165.soap.EmployeeSoapService;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author shifty
 */
public class EmployeeManager {
  
    private final static Logger log = LoggerFactory.getLogger(EmployeeManager.class);
    
    private List<EmployeeDTO> employees;

    private EmployeeSoapService ess;
    
    public EmployeeManager() {
        ess = new EmployeeService().getEmployeeSoapServiceImplPort();
    }
    
    public cz.muni.fi.pa165.soap.EmployeeDTO getEmployeeById(Long id) {        
        return ess.getEmployee(id);
    }
    
    public List<EmployeeDTO> loadEmployees() {
        return ess.getEmployees();
    }
    
    public void removeEmployee(Long id) {
        log.debug("removeEmployee() {}",id);
        EmployeeDTO e = new EmployeeDTO();
        e.setId(id);
        ess.removeEmployee(e);
    }
    
    public void createEmployee(EmployeeDTO e) {
        ess.createEmployee(e);
    }
    
    public void updateEmployee(EmployeeDTO e) {
        ess.updateEmployee(e);
    }
}
